home *** CD-ROM | disk | FTP | other *** search
/ boe.pres.k12.wv.us / boe.pres.k12.wv.us.zip / boe.pres.k12.wv.us / Utilities / Xerox Workcentre 5335 / Windows Scan / 64-bit_x64 / Russian / cpsimage.cab / data / xipScripts / imsView.elf < prev    next >
Text File  |  2009-04-23  |  2KB  |  67 lines

  1. /* @imsView
  2.   // DESCRIPTION
  3.     Read XOG IMS (Intermediate MRC Stream) format image file or
  4.   XIPIMAGE object file and display the contents via spd. It will
  5.   produce a display for each layer in the file where the title of
  6.   the window has the layer value starting at zero.  
  7.  
  8.   By default it will read and display all raster layers.  To view
  9.   a specific layer use the layer import variable.
  10.  
  11.   // EXAMPLES
  12.  
  13.   IMS file:
  14.   > xipe xipScripts/imsView.elf -im infile:s filename
  15.   or
  16.   > xipe xipScripts/imsView.elf -im infile:s filename layer:i n
  17.  
  18.   OBJECT file:
  19.   > xipe xipScripts/imsView.elf -im objfile:s filename
  20.   or
  21.   > xipe xipScripts/imsView.elf -im objfile:s filename layer:i n
  22.  
  23. */
  24.  
  25. /* Script to view layers in IMS image */
  26. LoadClasses (filename: "xeng");
  27.  
  28. IMPORT STRING infile;
  29. IMPORT STRING objfile;
  30. IMPORT INTEGER layer;
  31.  
  32. if ( !infile && !objfile )
  33.   { print "need import of infile:s name || objfile:s name"; end; }
  34.  
  35. if ( infile )
  36.    XIPIMAGE img = ReadIMS (filename: infile);
  37. else if ( objfile )
  38.    XIPIMAGE img = ReadObject (filename: objfile);
  39.  
  40. if (!img || img.Type() != "XIPIMAGE" )
  41.   { print "invalid object type, expect XIPIMAGE got "+img.Type(); end; }
  42.  
  43. INTEGER ltype, i, j;
  44. if ( layer ) {
  45.   ltype = img.getMember (num:layer, member:"layerType");
  46.   if ( ( ltype == XIP_Contone   || ltype == XIP_ContoneMask ||
  47.          ltype == XIP_ColorMask || ltype == XIP_Binary ) )
  48.     img.getLayer (num:layer).unCompress(
  49.       ).display(command: "spd -nogamma -title layer" + layer);
  50. }
  51. else {
  52.   for (j=0; j<img.nlayers; j++) {
  53.     
  54.     // Layertype has to be a raster
  55.     ltype = img.getMember (num:j, member:"layerType");
  56.     if ( !( ltype == XIP_Contone   || ltype == XIP_ContoneMask ||
  57.             ltype == XIP_ColorMask || ltype == XIP_Binary ) )
  58.       continue;
  59.   
  60.     try {
  61.       img.getLayer (num:j).unCompress().display(command: "spd -nogamma -title layer" + j);
  62.     } catch {
  63.       print "failed on layer " + j;
  64.     }
  65.   }
  66. }
  67.